package org.elip.teststatistics.server.selectors;

import org.apache.commons.vfs2.AllFileSelector;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelectInfo;

public class LogsFileSelector extends AllFileSelector{
	
	@Override
	public boolean includeFile(FileSelectInfo fileInfo) {
		
		FileObject file = fileInfo.getFile();

		String baseName = file.getName().getBaseName();

		boolean isLog = file.getName().getExtension().equals("log");
		
		boolean isServerSide = baseName.contains("gigaspaces");

		return (isLog && !isServerSide);

	}
	
	@Override
	public boolean traverseDescendents(FileSelectInfo fileInfo) {
		if (fileInfo.getDepth() == 0) return true;
		return false;
	}

}
